<%--
  Created by IntelliJ IDEA.
  User: SYHT
  Date: 2017/8/18
  Time: 15:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--解析表达式--%>
<%@ page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <jsp:include page="dist.jsp"/>
</head>

<body class="login_bg">
<div class="login_all">
    <div class="login_center">
        <form id="form" action="${pageContext.request.contextPath}/XzLogin/LoginBack3.emp" method="post" onsubmit="return sub()">
            <h3 class="login_h3">登 录</h3>
            <div>
                <input id="username" type="text" name="username" placeholder="请输入用户名" class="login_input"/></div>
            <div>
                <input id="password" type="password" name="password" placeholder="请输入密码" class="login_input"/></div>

            <%--错误信息--%>
            <div class="back_err" id="err_msg">
                <c:if test="${msg!=null}">
                    ${msg}
                </c:if>
            </div>

            <button type="submit" class="login_button">确定</button>
        </form>
    </div>
</div>
<script>
    $(function () {
        $('#username').on('blur', function () {
            if ($('#username').val() == "" || $('#username').val() == null) {
                $('#err_msg').html('请输入用户名!');
                return false;
            } else {

            }
        })
    });
    $(function () {
        $('#password').on('blur', function () {
            if ($('#password').val() == "" || $('#password').val() == null) {
                $('#err_msg').html('请输入密码!');
                return false;
            } else {

            }
        })
    });

    function sub() {
        if ($('#username').val() == "" || $('#username').val() == null) {
            $('#err_msg').html('请输入用户名!');
            return false;
        }
        if ($('#password').val() == "" || $('#password').val() == null) {
            $('#err_msg').html('请输入密码!');
            return false;
        }
    }
    ;
</script>
</body>
</html>
